#include<stdio.h>
#define QUEUESIZE 10
#include<math.h>
typedef int DataType;
#define MAXSIZE 10

typedef struct Squeue
{
    DataType queue[MAXSIZE];
    int front,rear;
    int tag;
}SCQueue;

void PrintData(DataType e);
int QueueEmpty(SCQueue *SCQ);
int EnQueue(SCQueue *SCQ, DataType e);
int DeQueue(SCQueue *SCQ, DataType *e);
void DisplayQueue(SCQueue *SCQ);
void InitQueue(SCQueue *SCQ);
int main()
{
    freopen("in.txt","r",stdin);
    DataType x;
    SCQueue SCQ;
    InitQueue(&SCQ);
    while(scanf("%d",&x) != EOF)
    {
        EnQueue(&SCQ,x);
    }
    DisplayQueue(&SCQ);
}

void InitQueue(SCQueue *SCQ)
{
    SCQ->tag = 0;
    SCQ->front = SCQ->rear = 0;
}

int QueueEmpty(SCQueue *SCQ)
{
    if(SCQ->tag == 0 && SCQ->front == SCQ->rear) return 1;
    else return 0;
}

int EnQueue(SCQueue *SCQ, DataType e)
{
    if(SCQ->tag == 1 && SCQ->front == SCQ->rear)
    {
        printf("QUEUE IS FULL\n");
        return 0;
    }
    else
    {
        SCQ->queue[(SCQ->rear)%MAXSIZE] = e;
        SCQ->rear = (SCQ->rear+1) % MAXSIZE;
        SCQ->tag = 1;
        return 1;
    }
}

int DeQueue(SCQueue *SCQ, DataType *e)
{
    if(SCQ->tag == 0 && SCQ->front == SCQ->rear)
    {
        printf("QUEUE IS EMPTY\n");
        return 0;
    }
    else
    {
        *e = SCQ->queue[SCQ->front];
        SCQ->front = (SCQ->front + 1) % MAXSIZE;
        SCQ->tag = 0;
        return 1;
    }
}

void DisplayQueue(SCQueue *SCQ)
{
    if(QueueEmpty(SCQ))
    {
        printf("QUEUE IS EMPTY\n");
    }
    else
    {
        DataType e;
        while(DeQueue(SCQ, &e))
        {
            PrintData(e);
        }
    }
}

void PrintData(DataType e)
{
    printf("ELEMENTYPE = %d\n", e);
}
